//
//  NetworkParam+Center.m
//  LingQianZhu
//
//  Created by xieyingze on 2016/12/16.
//  Copyright © 2016年 谢英泽. All rights reserved.
//

#import "NetworkParam+Center.h"
#import <objc/runtime.h>

static const char kNetworkParamParamKey;
static const char kNetworkParamKeyKey;

@implementation NetworkParam (Center)

/**
 *  参数param
 */
- (NSDictionary *)param {
    return objc_getAssociatedObject(self, &kNetworkParamParamKey);
}
- (void)setParam:(NSDictionary *)param {
    if (![param isKindOfClass:[NSDictionary class]]) return;
    [self willChangeValueForKey:@"param"];
    objc_setAssociatedObject(self, &kNetworkParamParamKey, param, OBJC_ASSOCIATION_RETAIN_NONATOMIC);
    [self didChangeValueForKey:@"param"];
}

/**
 *  key
 */
- (NSString *)key {
    return objc_getAssociatedObject(self, &kNetworkParamKeyKey);
}

- (void)setKey:(NSString *)key {
    if (![key isKindOfClass:[NSString class]]) return;
    [self willChangeValueForKey:@"key"];
    objc_setAssociatedObject(self, &kNetworkParamKeyKey, key, OBJC_ASSOCIATION_COPY_NONATOMIC);
    [self didChangeValueForKey:@"key"];
}

@end
